<!-- 科研管理-样品管理--来样留洋 -->
<template>
  <div class="JNPF-common-layout">
    <div class="JNPF-common-layout-center">
      <el-row class="JNPF-common-search-box" :gutter="16">
        <el-form @submit.native.prevent>

          <el-col :span="6">
            <el-form-item label="申请时间">
              <el-date-picker
                v-model="listQuery.forddate"
                type="daterange"
                placeholder="选择日期">
              </el-date-picker>
            </el-form-item>
          </el-col>

          
          <el-col :span="6">
            <el-form-item label="委托单位">
              <el-select v-model="listQuery.fsupno" placeholder="请选择">
                 <el-option
                   v-for="item in supplist"
                   :key="item.fsupno"
                   :label="item.fsupname"
                   :value="item.fsupno">
                 </el-option>
               </el-select>
             </el-form-item>
          </el-col>

          <template v-if="showAll">

            <el-col :span="6">
              <el-form-item label="单据编号">
                <el-input></el-input>
              </el-form-item>
            </el-col>

            <el-col :span="6">
            <el-form-item label="完成时间">
              <el-date-picker
               v-model="listQuery.foverdate"
               type="date"
               placeholder="选择日期">
               </el-date-picker>
           </el-form-item>
          </el-col>

          <el-col :span="6">
            <el-form-item label="单据状态">
              <el-select v-model="listQuery.fbillstate" placeholder="请选择">
                <el-option
                  v-for="item in options"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>

          <el-col :span="6">
            <el-form-item label="受理人员">
              <el-select v-model="listQuery.frecuser" placeholder="请选择">
                 <el-option
                   v-for="item in getListSpeakerId"
                   :key="item.value"
                   :label="item.label"
                   :value="item.value">
                 </el-option>
               </el-select>
             </el-form-item>
          </el-col>

        </template>

          <el-col :span="6">
            <el-form-item label="">
              <el-button type="primary" icon="el-icon-search" @click="getlist">查询</el-button>
              <!-- <el-button type="success" icon="el-icon-plus" @click="insert(undefined)">新增</el-button> -->
              <!-- <el-button type="warning" icon="el-icon-upload2">导入</el-button> -->
              <el-button type="text" icon="el-icon-arrow-down" @click="showAll = true" v-if="!showAll">展开</el-button>
              <el-button type="text" icon="el-icon-arrow-up" @click="showAll = false" v-else>
                收起</el-button>
            </el-form-item>
          </el-col>
        </el-form>
      </el-row>
      <div class="JNPF-common-layout-main JNPF-flex-main">
        <JNPF-table :data="list" border v-loading="loading">
            <el-table-column align="left" label="委托单号" prop="fbillno" width="105"/>
            <el-table-column align="left" label="委托时间" prop="forddate" width="100"></el-table-column>
            <el-table-column align="left" label="委托单位" prop="forduser" />
            <el-table-column align="left" label="受理人" prop="frecuser" width="95"/>
            <el-table-column align="left" label="完成时间" prop="foverdate" width="100"></el-table-column>
            <!-- <el-table-column align="left" label="受理时间" prop="frecdate" width="200"> </el-table-column> -->
            <el-table-column align="left" label="品项数" prop="fitemcount" width="85"/>
            <el-table-column align="left" label="总件数" prop="fpiececount" width="85"/>
            <el-table-column align="left" label="状态" prop="fbillstate" width="85"/>
            <!-- <el-table-coumn  align="left" label="备注" prop="fexplanation" /> -->
            <el-table-column fixed="left" align="left" label="操作" width="150">
            <template slot-scope="scope">
              <el-button @click.native.prevent="insert(scope.row.FCATNO)" icon="el-icon-edit" type="text" size="small">
                留样
              </el-button>
              <el-popconfirm title="这是一段内容确定删除吗？" @confirm="Catdelete(scope.row.FCATNO)">
                <el-button slot="reference" icon="el-icon-delete" style="color: red;margin-left: 10px;"
                  type="text">删除</el-button>
              </el-popconfirm>
            </template>
          </el-table-column>
        </JNPF-table>
        <pagination :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.limit" />
        <Form ref="Form"  />
      </div>
    </div>
  </div>
</template>

<script>
  import Form from "./Form.vue"
  export default {
    name: 'shop',
    components: { Form},
    data() {
      return {
        showAll:false,
        options: [],
        getListSpeakerId: [],
        supplist:[],
        total: 0,
        list: [{
            "fbillno":"P2412160005",
            "forddate":"2024-12-16",
            "forduser":"上海全是肉供应链管理有限公司",
            "frecuser":"曹操",
            "foverdate":"2024-12-24",
            "fitemcount":2,
            "fpiececount":15,
            "ftotalamt":5900.00,
            "fbillstate":"登记中"
            },{
            "fbillno":"P2412170009",
            "forddate":"2024-12-17",
            "forduser":"‌烟台市董果巴巴食品有限公司",
            "frecuser":"刘备",
            "foverdate":"2024-12-25",
            "fitemcount":2,
            "fpiececount":20,
            "ftotalamt":5900.00,
            "fbillstate":"登记中"
            },{
            "fbillno":"P2412170012",
            "forddate":"2024-12-17",
            "forduser":"江苏凌家塘市场发展有限公司",
            "frecuser":"关羽",
            "foverdate":"2024-12-25",
            "fitemcount":2,
            "fpiececount":20,
            "ftotalamt":5900.00,
            "fbillstate":"登记中"
            }],
        loading: false,
        listQuery: {
          page: 1,
          limit: 20,
          sort: "desc",
          sidx: "",
          fsiteNo: undefined,
          forddate:[new Date(),new Date()],
          foverdate:new Date(),
          fsupno:undefined,
          fbillstate:0,
          fsupno:undefined,
          frecuser:undefined
        },
      };
    },
    computed: {},
    created() {
    },
    methods: {
      insert(row) {
        this.$refs.Form.init(row);
      },
      //标签
      labelTag(row) {
        this.$refs.Tabs.opentabs(row);
      },
    },
  };
</script>